package com.FSS.FileList;

import java.io.File;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.FSS.File.IFile;
import com.FSS.config.Config;

public class DeleteList extends FileList {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7490282120443443904L;
	private int id;
	private Date deleteTime;
	public DeleteList(String date){
		  DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); 
		  try {
			deleteTime = df.parse(date);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public DeleteList(Date dt){
		deleteTime = dt	;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public Date getDeleteTime() {
		return deleteTime;
	}

	public void setDeleteTime(Date deleteTime) {
		this.deleteTime = deleteTime;
	}
	public void deleteAll(){
		for(IFile file:this){
			File f = new File(Config.DOC_LOCATION+file.getName());
			if(f.exists()&&f.isFile())
				f.delete();
		}
		 removeAll(this);
	}
	public  boolean overSetTime(){
		Date current=new Date();
		return current.after(deleteTime);
	}
}
